package peter.study.spring.parsesource.mvc.controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import peter.study.spring.parsesource.mvc.bean.User;

public class UserController extends AbstractController{

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse resp) throws Exception {
        List<User> list = new ArrayList<>();
        User user1 = new User("Peter", 26);
        User user2 = new User("Geven", 25);
        list.add(user1);
        list.add(user2);
        return new ModelAndView("userlist", "users", list);
    }

}
